home *** CD-ROM | disk | FTP | other *** search
/ DOpus Plus / DOpus Plus.iso / Tutorial / ARexx Tutorial / TuteRexx / LhAAppIcon.dopus5 < prev    next >
Text File  |  1998-09-24  |  2KB  |  75 lines

  1. /*
  2. $VER$: LhAAppIcon.dopus5 1.0 (1.9.98)
  3. Call as:  LhAAppIcon.dopus5 {Qp}
  4. */
  5. options results
  6. parse arg port .
  7.  
  8. lf = '0a'x
  9. LhAID = 'aLHA'                                /* Change this line to suit your LhA filetype ID */
  10. iconname = 'DOpus5:Icons/filetypes/Archive'
  11. output = 'RAM:'
  12. if port = '' then port = 'DOPUS.1'
  13. address value port
  14.  
  15. If ~Show('L','rexxsupport.library') then call addlib('rexxsupport.library',0,-30,0)
  16.  
  17. call openport('LhAAppIcon-handler')
  18. appmenu.count = 1
  19. appmenu.0 = 'Config'
  20. dopus addappicon 'LhAAppIcon-handler' "'LhAAppIcon'" 1 icon iconname info quotes close local menu appmenu.
  21. iconhandle = result
  22. flag = 0
  23. do while flag = 0
  24.   if waitpkt('LhAAppIcon-handler') then do
  25.     packet = getpkt('LhAAppIcon-handler')
  26.     arg0 = getarg(packet,0)
  27.     arg1 = getarg(packet,1)
  28.     arg2 = getarg(packet,2)
  29.     arg3 = getarg(packet,3)
  30.     arg4 = getarg(packet,4)
  31.     call reply(packet,0)
  32.     if arg0 = 'menu' & arg2 = 0 then call Config
  33.     if arg0 = 'info' then do
  34.       text = 'LhAAppIcon 1.0 (1.9.98)'||lf||lf||'G''day :)'
  35.       dopus request '"'text'" OK'
  36.       end
  37.     if arg0 = 'dropfrom' then call WeGotOne
  38.     if arg0 = 'close' then flag = 1
  39.     if arg0 = 'removed' then flag = 2
  40.     end
  41. end
  42. if flag~=2 then dopus remappicon iconhandle
  43. call closeport('LhAAppIcon-handler')
  44. exit
  45.  
  46. Config:
  47. valid = 0
  48. do while valid = 0
  49.   text = '"Please enter a path to extract files to:" 30 "'output||'" OK|Cancel'
  50.   dopus getstring text
  51.   if dopusrc = 0 | result = '' then result = 'RAM:'
  52.   if pos(right(strip(result,,'"'),1),':/') > 0 then
  53.     if exists(result) then do
  54.       valid = 1
  55.       output = result
  56.       end
  57. end
  58. return
  59.  
  60. WeGotOne:
  61. if arg2 = '' then return
  62. lister query arg3 path
  63. path = result
  64. dopus setappicon iconhandle busy on
  65. files = arg2
  66. do while files ~= ''
  67.   parse var files'"'file'"' files
  68.   file = strip(path,,'"')||strip(file,,'"')
  69.   dopus getfiletype '"'file'"' ID
  70.   if result = LhAID then
  71.     address command 'LhA >NIL: x "'file'" 'output
  72. end
  73. dopus setappicon iconhandle busy off
  74. return
  75.